<!DOCTYPE html>
<html lang="en">

<head>
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" /> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="UTF-8">
    <link rel="stylesheet" href="webpage/css/swiper-4.3.5.min.css">
    <link rel="stylesheet" href="webpage/css/main.css">
    <link rel="stylesheet" href="webpage/css/iconfont/iconfont.css">
    <!-- <link rel="stylesheet" href="css/style.css"> -->
    <!-- 引入样式 -->
    <link rel="stylesheet" href="webpage/css/element.css">
    <link rel="stylesheet" href="webpage/css/index.css">
    
    <!-- <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> -->
    <script src='webpage/js/jr.js'></script>
    <title>首页</title>
</head>

<body>
    <div id="app" @click='document_click' v-cloak>
        <chat_room  v-show="chatRoom" :firm-im='firmIm' @forroom="showRoom"></chat_room>
        <!-- side_nav -->
        <div class="side_nav">
            <ul>
                <li>
                    <div class="side_icon fr" @mouseenter='geren_hover' @mouseleave='geren_leave' @click='geren_page'>
                        <img src="webpage/images/icon_my.png" alt="">
                    </div>
                    <div class="hide_icon fl" v-show='geren'>会员中心</div>
                </li>
                <li>
                    <div class="side_icon fr" @mouseenter='gouwuche_hover' @mouseleave='gouwuche_leave' @click='gouwuche_page'>
                        <img src="webpage/images/iocn_gouwu_2.png" alt="">
                    </div>
                    <div class="hide_icon fl" v-show='gouwuche'>购物车</div>
                </li>
                <li>
                    <div class="side_icon fr" @mouseenter='shoucang_hover' @mouseleave='shoucang_leave' @click='shoucang_page'>
                        <img src="webpage/images/icon_shoucang_2.png" alt="">
                    </div>
                    <div class="hide_icon fl" v-show='shoucang'>收藏</div>
                </li>
                <li>
                    <div class="side_icon fr" @mouseenter='zuji_hover' @mouseleave='zuji_leave' @click='zuji_page'>
                        <img src="webpage/images/icon_zuji_2.png" alt="">
                    </div>
                    <div class="hide_icon fl" v-show='zuji'>我的足迹</div>
                </li>
                <li>
                    <div class="side_icon fr" @mouseenter='liaotian_hover' @mouseleave='liaotian_leave' @click='liaotian_page'>
                        <img src="webpage/images/icon_xiaoxi_2.png" alt="">
                    </div>
                    <div class="hide_icon fl" v-show='liaotian'>消息中心</div>
                </li>
            </ul>
        </div>

        <!-- nav -->
        <div class="max_width header">
            <div class="wrap">
                <div class="header_nav fr">
                    <ul class="nav_list">
                        <li class="personname" v-show='!person_infos' @click.stop='cancle_info'><img :src="info.viaUrl" class="fl header_img" alt=""  >
                            <span class="fl" >{{info.nickname}}</span>
                            <div class="zhuxiao" v-show='cancle' @click='clear_info'>注销</div>
                        </li>
                        <!-- <li class="header_index">首页</li> -->
                        <li class="login_btn nav_item" @click='login_btn' v-show='person_infos'>登录</li>
                        <li class="nav_item" @click='register' v-show='person_infos'>免费注册</li>
                        <!-- <li class="nav_line"></li> -->
                        <li class="nav_item " @click.stop='person_vip'>
                            <div :class="{active:person_vips}">会员中心 <img src="webpage/images/icon_down.png" alt="" class="nav_icon"></div>
                            <div class="person_sub" v-show='person_vips'>
                                <ul>
                                    <li @click='person_order'>首页</li>
                                    <li @click='person_center'>我的订单</li>
                                    <li @click='person_address'>收货地址</li>
                                    <li @click='person_exchange_page'>积分换货</li>
                                    <li @click='person_intergal'>积分订单</li>
                                    <li @click='person_collection'>我的收藏</li>
                                    <li @click='person_foot'>浏览足迹</li>
                                    <li @click='person_ticket'>优惠券</li>
                                    <li @click='person_info'>个人设置</li>
                                    <li @click='person_message'>消息中心</li>
                                </ul>
                            </div>
                        </li>
                        <!-- <li class="nav_line"></li> -->
                        <li class="nav_item">商家后台</li>
                        <!-- <li class="nav_line"></li> -->
                        <li class="nav_item" @click.stop='service'>
                            <div :class="{active:services}">客户服务 <img src="webpage/images/icon_down.png" alt="" class="nav_icon"></div>
                            <div class="person_sub" v-show='services'>
                                <ul>
                                    <li @click='feedback'>用户反馈</li>
                                    <!-- <li>咨询客服</li> -->
                                </ul>
                            </div>
                        </li>
                        <!-- <li class="nav_line"></li> -->
                        <li class="nav_item">手机商城</li>
                    </ul>
                </div>
            </div>
        </div>
        <!-- search -->
        <div class="search wrap">
            <div class="logo fl">

            </div>
            <div class="search_box fl">
                <input type="text" name="" id="" v-model='keyword' class="search_input" placeholder="" @keyup.enter='submit'>
                <div class="search_btn" @click='search_nav(keyword)'>
                    <img src="webpage/images/search-2.png" alt="">
                </div>
                <div class="history_search">
                    <ul>
                        <li class="cursor" v-for='(item,index) in hot_list' @click='search_nav(item.searchName)'>{{item.searchName}}</li>
                    </ul>
                </div>
            </div>

            <div class="car_box fl">
                <div class="search_shop_car cursor" @click='car_box' :class="{search_car_active:car_active}">
                    <img src="webpage/images/icon_gouwu.png" alt=""> <span class="fl">购物车（{{all_quantity}}）</span>
                </div>
                <div class="car_popup" v-show='car_active'>
                    <div class="car_popup_list">
                        <div class="car_popup_item" v-for='item in groups'>
                            <div class="car_popup_img fl">
                                <img :src='item.goodsImgs' />
                            </div>
                            <div class="car_popup_tit fl">
                                {{item.goodsName}}
                            </div>
                            <div class="car_popup_money fr">
                                <p>￥{{item.goodsPrice}} x {{item.goodsQuantity}}</p>
                            </div>
                        </div>
                    </div>
                    <div class="car_popup_footer">
                        <p class="car_all_money">共{{all_quantity}}件商品，共计￥{{all_price}}</p>
                        <p class="car_popup_btn fr cursor" @click='go_shop_car'>去购物车</p>
                    </div>
                </div>
            </div>
        </div>


        <!-- 商品分类 -->
        <div class="max_width class_max_box clea_both" @mouseover='hide_datas'>
            <div class="class_box clear_both wrap">
                <div class="sub_nav_box">
                    <div class="product_class fl" @click='showRoom'>
                        商品分类
                    </div>
                    <ul class="sub_nav fl">
                        <li @click='seckilling'>限时秒杀</li>
                        <li @click='group_buy'>团购优惠</li>
                        <li @click='cyc_buy'>周期购</li>
                        <li @click='integral'>积分商城</li>
                    </ul>
                </div>
                <div class="list_box clear_both">
                    <div class="product_list fl">
                        <ul class="first_datas fl" @mouseover.stop='third_datas_close'>
                            <li v-for='(item,index) in treeDatas' class="cursor" @click='search_btn(item.intId,item.value)'
                                @mouseover='first_datas(index)'>{{item.value}}</li>
                        </ul>
                        <ul class="second_wrap fl" v-show='second_show' @mouseover.stop=''>
                            <li v-for='(item,index) in second_list'>
                                <p class="second_tit cursor" @click='search_btn(item.intId,item.value)' >{{item.value}}</p>
                                <span v-for='(item,index) in item.children' class="second-text cursor" @click='search_btn(item.intId,item.value)'>{{item.value}}</span>
                            </li>
                        </ul>
                        <!-- <ul class="second_datas fl" v-show='second_show' @mouseover.stop=''>
                            <li v-for='(item,index) in second_list' class="cursor" @click='search_btn(item.intId,item.value)'
                                @mouseover='second_datas(index)'>{{item.value}}</li>
                        </ul>
                        <ul class="third_datas fl" v-show='third_show' @mouseover.stop=''>
                            <li v-for='(item,index) in third_list' @click='search_btn(item.intId,item.value)' class="cursor">{{item.value}}</li>
                        </ul> -->
                    </div>

                    <!-- Swiper -->
                    <div class="swiper-container fl turn_pic">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide" v-for='item in pic'>
                                <img :src="item.imageUrl" alt="" class="pic_turn">
                            </div>

                        </div>
                        <!-- Add Pagination -->
                        <div class="swiper-pagination turn-pagination"></div>
                    </div>





                    <div class="pic_list fl">
                        <ul>
                            <li class="cursor" v-for='(item,index) in ad_lists' @click='ad_active(index)'><img :src="item.imageUrl" alt=""></li>
                            <!-- <li><img :src="item.coverImg" alt=""></li> -->
                            <!-- <li><img :src="ad_lists[0].imageUrl" alt=""></li> -->
                            <!-- <li><img :src="ad_lists[1].imageUrl" alt=""></li> -->
                            <!-- <li><img :src="ad_lists[2].imageUrl" alt=""></li> -->
                        </ul>
                    </div>

                </div>
            </div>
        </div>

        <!-- 秒杀 -->
        <div class="wrap seckill" v-show='seckill_show'>
            <div class="seckill_tit fl">
                <p class="seckill_tit_text">限时秒杀</p>
                <img src="webpage/images/icon_shandian.png" class="shandian" alt="">
                <div class="time_out">
                    <p class="time_tit">{{time_text}}</p>
                    <div class="timer">
                        <span id='_d'></span>
                        <span id='_h'></span>
                        <span id='_m'></span>
                        <span id='_s'></span>
                    </div>
                </div>
            </div>
            <div class="swiper-container seckill_swiper" @mouseenter='show_swiper_btn' @mouseleave='hidden_swiper_btn'>
                <div class="swiper-wrapper">
                    <div class="swiper-slide seckill_itme miaosha" v-for="(item,index) in secSpuList">
                        <div class="seckill_product cursor" @click='seckilling_detail(item.secKIllId,item.spuId)'>
                            <img :src="item.coverImg" alt="">
                        </div>
                        <p class="product_introduce">{{item.spuName}}</p>
                        <div class="product_price">
                            <div class="now_price">
                                <span>￥</span>{{item.seckillPrcice}}
                            </div>
                            <div class="old_price">
                                ￥<span>{{item.showPrice}}</span>
                            </div>
                        </div>
                    </div>

                </div>
                <!-- Add Arrows -->
                <!-- <div class="swiper-button-next" v-show='seckill_swiper_btn'></div> -->
                <!-- <div class="swiper-button-prev" v-show='seckill_swiper_btn'></div> -->
            </div>
        </div>

        <div class="wrap buying_box">
            <div class="group_buy fl">
                <div class="group_tit">
                    <span class="buy_cheap fl">团购优惠</span>
                    <span class="sun_cheap fl">价格更低</span>
                    <span class="look_more fr cursor" @click='group_buy'>更多 &gt;</span>
                </div>
                <div class="fl seckill_itme group_item" v-for='(item,index) in group_list'>
                    <div class="seckill_product cursor" @click='group_detail(item.id,item.goodsId)'>
                        <img :src="item.goodsImage" alt="">
                    </div>
                    <p class="product_introduce">{{item.goodsName}}</p>
                    <div class="product_price clear_both">
                        <div class="now_price fl" v-if="item.groupsSkuList.length>0">
                            <span>￥</span>{{item.groupsSkuList[0].goodsPrice}}
                        </div>
                        <!-- <div class="old_price"> -->
                        <div class="last_text fl">
                            <!-- <div class="fl">单买价 ￥{{item.groupsSkuList[0].salesPrice}}</div> -->
                            <div class="fr pin_num">{{item.saleNum}}人已拼</div>
                        </div>
                            <!-- ￥<span>3200</span> -->
                        <!-- </div> -->
                    </div>
                </div>
            </div>

            <div class="time_buy fl">
                <div class="group_tit">
                    <span class="buy_cheap fl">周期购</span>
                    <span class="sun_cheap fl">定期发货</span>
                    <span class="look_more fr cursor" @click='cyc_buy'>更多 &gt;</span>
                </div>
                <div class="fl seckill_itme group_item" v-for='(item,idnex) in cyc_list'>
                    <div class="seckill_product cursor" @click='cyc_detail(item.goodsId,item.id)'>
                        <img :src="item.coverImg" alt="">
                    </div>
                    <p class="product_introduce">{{item.spuName}}</p>
                    <div class="product_price">
                        <!-- <span class="money_icon">￥</span>{{item.periodicBuyDetailSkuList[0].goodsPrice}} <span class="old_money">￥{{item.periodicBuyDetailSkuList[0].salesPrice}}</span><span class="buy_btn fr">立即抢购</span> -->

                        <div class="now_price" v-if="item.periodicBuyDetailSkuList!=''">
                            <span>￥</span>{{item.periodicBuyDetailSkuList[0].goodsPrice}}
                        </div>
                        <div class="old_price" v-if="item.periodicBuyDetailSkuList!=''">
                            ￥<span>{{item.periodicBuyDetailSkuList[0].salesPrice}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>


        <!-- 热销产品 -->

        <div class="hot_sell_tit">—— 热销商品 ——</div>
        <div class="swiper-container wrap hot_sell" @mouseenter='show_swiper_btn' @mouseleave='hidden_swiper_btn'>
            <div class="swiper-wrapper">
                <div class="swiper-slide hot_itme" v-for="(item,index) in hotsales">
                    <div class="seckill_product cursor" @click='product_detail(item.id,item.shopId)'>
                        <img :src="item.coverImg" alt="" srcset="">
                    </div>
                    <p class="product_introduce">{{item.spuName}}</p>
                    <div class="product_price">
                        <div class="now_price">
                            <span>￥</span>{{item.showPrice}}
                        </div>
                        <div class="old_price">
                        </div>
                    </div>
                </div>

            </div>
            <!-- Add Arrows -->
            <!-- <div class="swiper-button-next" v-show='seckill_swiper_btn'></div> -->
            <!-- <div class="swiper-button-prev" v-show='seckill_swiper_btn'></div> -->
        </div>


        <!-- 猜你喜欢 -->
        <div class="hot_sell_tit">—— 猜你喜欢 ——</div>
        <div class="you_like wrap">
            <div class="like_item fl" v-for='(item,index) in fondMdse'>
                <div class="like_product cursor" @click='product_detail(item.id)'>
                    <img :src="item.coverImg" alt="">
                </div>
                <p class="product_introduce">{{item.spuName}}</p>
                <div class="product_price">
                    <div class="now_price">
                        <span>￥</span>{{item.showPrice}}
                    </div>
                    <div class="sell_num fr">
                        销量<span>{{item.salesQuantity}}</span>
                    </div>
                </div>
            </div>
        </div>


        <div class="wrap footer_copy">
            <div class="link_list">
                <span class="footer_link">关于我们</span>
                <span class="footer_link">联系我们</span>
                <span class="footer_link">开通店铺</span>
                <span class="footer_link">会员中心</span>
                <span class="footer_link">商家后台</span>
                <span class="footer_link">手机商城</span>
                <span class="footer_link">问题咨询</span>
                <span class="footer_link">意见反馈</span>
                <span class="footer_link">隐私政策</span>
            </div>


            <div class="copyright">
                京公网安备 11000002000088号|京ICP证070359号|互联网药品信息服务资格证编号(京)-经营性-2014-0008|新出发京零 字第大120007号
            </div>
            <div class="copyright">
                互联网出版许可证编号新出网证(京)字150号|出版物经营许可证|网络文化经营许可证京网文[2014]2148-348号|违法和不良信息举报电话：4006561155
            </div>

        </div>


    </div>
    <script src="https://cdn.ronghub.com/RongIMLib-2.3.3.min.js"></script>
    <script src="https://cdn.ronghub.com/RongEmoji-2.2.7.min.js"></script>
    <script src="webpage/js/axios.js"></script>
    <script src="webpage/js/qs.js"></script>
    <script src="webpage/js/swiper-4.3.5.min.js"></script>
    <script src="webpage/js/vue.js"></script>
    <script src="webpage/js/element.js"></script>
    <script src="webpage/js/main.js"></script>
    <script src='webpage/chatroom/chatroom.js'></script>
    <script type="text/babel">
    var browser={
        versions:function(){
            var u = navigator.userAgent, app = navigator.appVersion;
            return {
                trident: u.indexOf('Trident') > -1, //IE内核
                presto: u.indexOf('Presto') > -1, //opera内核
                webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
                gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,//火狐内核
                mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
                ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
                android: u.indexOf('Android') > -1 || u.indexOf('Adr') > -1, //android终端
                iPhone: u.indexOf('iPhone') > -1 , //是否为iPhone或者QQHD浏览器
                iPad: u.indexOf('iPad') > -1, //是否iPad
                webApp: u.indexOf('Safari') == -1, //是否web应该程序，没有头部与底部
                weixin: u.indexOf('MicroMessenger') > -1, //是否微信 （2015-01-22新增）
                qq: u.match(/\sQQ/i) == " qq" //是否QQ
            };
        }(),
        language:(navigator.browserLanguage || navigator.language).toLowerCase()
    }
    RongIMLib.RongIMEmoji.init();
    var mylist = RongIMLib.RongIMEmoji.list;
    for (let n = 0; n < mylist.length; n++) {
      mylist[n].node = RongIMLib.RongIMEmoji.emojiToHTML(mylist[n].emoji);
    }
    RongIMLib.RongIMEmoji.list = mylist;
        var app = new Vue({
            el: '#app',
            data() {
                return {
                    seckill_swiper_btn:false,
                    books:20,
                    groups:'',
                    asdasd:3,
                    pic:'',
                    ad_lists:'',
                    seckill_show:true,
                    // 导航条
                    person_vips:false,
                    services:false,
                    car_active:false,
                    // 侧导航
                    geren:false,
                    gouwuche:false,
                    shoucang:false,
                    zuji:false,
                    liaotian:false,
                    person_infos:true,
                    info:'',
                    token:localStorage.getItem('wACCESS_TOKEN'),
                    // 热卖
                    hotsales:'',
                    hot_list:'',
                    // 三级分类
                    treeDatas:'',
                    second_show:false,
                    second_index:0,
                    second_list:'',
                    third_show:false,
                    third_index:0,
                    third_list:'',
                    fondMdse:'',
                    // 购物车
                    all_quantity:0,
                    all_price:'',
                    quantity:'',
                    secSpuList:'',
                    // miaosha 
                    time_text:'',
                    use_time:'',
                    group_list:'',
                    keyword:'',
                    cyc_list:'',
                    // 聊天
                    chatRoom:false,
                    firmIm:'',
                    // 注销登录
                    cancle:false,
                    ie:false
                };
            },
            created(){
                this.getUserByToken()
            },
            beforeUpdate() {
            },
            mounted() {
                if(browser.versions.trident){ 
                    this.$alert('请切换极速模式', '', {
                    confirmButtonText: '确定',
                    callback: action => {
                        
                    }
                    });
                }
                this.scrollBehavior()
                this.hotSaleMdse()
                // 轮播图
                var turn_pic = new Swiper('.turn_pic', {
                    autoplay: true,
                    on:{
                        autoplay:function(){
                        },
                    },
                    observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                    observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                    onSlideChangeEnd: function(swiper){ 
                        swiper.update();  
                        mySwiper.startAutoplay();
                        mySwiper.reLoop();  
                    }
                });
                // 秒杀
                var mySwiper = new Swiper('.seckill_swiper',{
                    slidesPerView: 5,
                    spaceBetween: 30,
                    slidesPerGroup: 2,
                    allowTouchMove: false,
                    loop: true,
                    loopFillGroupWithBlank: true,
                    navigation: {
                        nextEl: '.swiper-button-next',
                        prevEl: '.swiper-button-prev',
                    },
                    observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                    observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                    onSlideChangeEnd: function(swiper){ 
                        swiper.update();  
                        mySwiper.startAutoplay();
                        mySwiper.reLoop();  
                    },
                })
                
               
                mySwiper.slideTo(0, 0, false);
                this.getImageUrlList()
                this.hot_lists()
                this.getAllCategory()
                this.fondMdses()
                this.listUserUser()
                this.wscl()
                this.scgq()
                this.latestSecKillList()
                this.period()
                this.ad_list()
            },
            components: {

            },
            methods: {
                // 注销登录
                cancle_info(){
                    this.cancle = !this.cancle
                },
                clear_info(){
                    localStorage.removeItem("wACCESS_TOKEN");
                    localStorage.removeItem("userId");
                    localStorage.removeItem("ryName");
                    localStorage.removeItem("ryToken");
                    localStorage.removeItem("ryIcon");
                    localStorage.removeItem("ryUserid");
                    this.person_infos = !this.person_infos
                },
                // 秒杀
                seckilling_detail(id,spuId){
                    window.location.href='webpage/product/seckilling_detail.html?id='+id+'&spuId='+spuId
                },
                ad_active(index){
                    if (index==0) {
                        window.location.href='webpage/discount/seckilling.html'
                    }else if (index==1) {
                        window.location.href='webpage/discount/group_buy.html'
                    }else if (index==2) {
                        window.location.href='webpage/discount/cyc_buy.html'
                    }
                },
                // 广告
                ad_list(){
                    axios({
                        method:"POST",
                        url:base_url + "/ad/getImageUrlList",
                        data:Qs.stringify({
                            code:2,
                            pageSize:3,
                            pageNum:1
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.ad_lists = res.data.data.list.list
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },


                showRoom(data){
                    this.chatRoom=data
                // if (
                //     this.uid == "" ||
                //     this.uid == undefined ||
                //     this.token == "" ||
                //     this.token == undefined
                // ) {
                //     this.$message.error("请先登陆");
                // }else if (this.firmIm == localStorage['ryId']) {
                //     this.$message.error('不能和自己聊天')
                // }else{
                //     this.chatRoom=data
                // }
                },
                // 周期购列表
                period() {
                    axios({
                        method:"POST",
                        url:base_url + "/period/listUserUser",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.cyc_list = res.data.data.list.list.slice(0,3)
                        console.log(app.cyc_list)
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 团购列表
                listUserUser() {
                    axios({
                        method:"POST",
                        url:base_url + "/group/listUserUser",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.group_list = res.data.data.list.list.slice(0,3)
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },

                // 首页秒杀
                latestSecKillList(){
                    axios({
                        method:"POST",
                        url:base_url + "/admin/seckill/latestSecKillList",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        console.log(res.data.data)
                        if (res.data.data.secSpuList.length>0) {
                            app.secSpuList = res.data.data.secSpuList
                            app.end_time = res.data.data.timing.endTime
                            app.startTime = res.data.data.timing.startTime
                            //获取当前时间  
                            var date_time = new Date();  
                            var now = date_time.getTime();  
                            var end_time = new Date(res.data.data.timing.endTime);  
                            var end_data = end_time.getTime();  
                            var startTime = new Date(res.data.data.timing.startTime);  
                            var star_data = startTime.getTime();  
                            if (now<star_data) {
                                app.time_text = '本场距离开始还剩'
                                app.use_time = star_data
                            }else if (end_data>now&&now>star_data) {
                                app.time_text = '本场距离结束还剩'
                                app.use_time = end_data
                            }
                            
                            setInterval(() => {
                                console.log()
                                //获取当前时间  
                                var date = new Date();  
                                var now = date.getTime();  
                                // console.log(now)
                                //设置截止时间  
                                var str=app.use_time;
                                var endDate = new Date(str); 
                                var end = endDate.getTime();
                                //时间差  
                                var leftTime = end-now; 
                                //定义变量 d,h,m,s保存倒计时的时间  
                                var d,h,m,s;  
                                if (leftTime>=0) {  
                                    d = Math.floor(leftTime/1000/60/60/24);  
                                    h = Math.floor(leftTime/1000/60/60%24);  
                                    m = Math.floor(leftTime/1000/60%60);  
                                    s = Math.floor(leftTime/1000%60);                     
                                }
                                //将0-9的数字前面加上0，例1变为01
                                d = checkTime(d);
                                h = checkTime(h);
                                m = checkTime(m);
                                s = checkTime(s);
                                function checkTime(i){
                                    if (i<10) {
                                        i = "0"+i;
                                    }
                                return i;
                                }
                                //将倒计时赋值到div中  
                                document.getElementById("_d").innerHTML = d+"天";  
                                document.getElementById("_h").innerHTML = h+"时";  
                                document.getElementById("_m").innerHTML = m+"分";  
                                document.getElementById("_s").innerHTML = s+"秒"; 
                            }, 1000);
                        }else{
                            app.seckill_show = false
                        }
                       
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                countTime() {  
                     
        
                },
                // 搜索
                search_btn(id,value){
                    window.location.href='webpage/product/search.html?id='+id+'&value='+value
                },
                search_nav(keyword){
                    window.location.href='webpage/product/search.html?keyword='+keyword
                },
                submit(e){
                    if (e.keyCode==13) {
                        window.location.href='webpage/product/search.html?keyword='+this.keyword
                    }
                },

                // 购物车
                car_box(){
                    if (this.car_active==false) {
                        this.car_active = true
                    }else if (this.car_active == true) {
                        this.car_active = false
                    }
                    // this.car_active = !this.car_active
                },
                go_shop_car(){
                    window.location.href='webpage/product/shop_car.html'
                },
                // 购物车
                
                scgq(){
                    var that = this
                    axios({
                        method:"POST",
                        url:base_url + "/sc/scgq",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        that.quantity = res.data.data.quantity
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                wscl(){
                    var that = this
                    axios({
                        method:"POST",
                        url:base_url + "/sc/wscl",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        that.groups = res.data.data.list
                        var all_quantity = 0
                        var all_price = 0
                        for (let i = 0; i < res.data.data.list.length; i++) {
                            all_quantity += res.data.data.list[i].goodsQuantity
                        }
                        for (let j = 0; j <  res.data.data.list.length; j++) {
                            all_price += res.data.data.list[j].goodsQuantity*res.data.data.list[j].goodsPrice
                        }
                        that.all_price = all_price
                        that.all_quantity = all_quantity
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },

                // 三级分类
                getAllCategory(){
                    axios({
                        method:"POST",
                        url:base_url + "/admin/category/getAllCategory",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.treeDatas = res.data.data.treeDatas
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                first_datas(index){
                    app.second_show = true
                    app.second_index = index
                    app.second_list = app.treeDatas[index].children
                    // app.third_list = app.second_list[index].children
                },
                third_datas_close(){
                    app.third_show = false
                },
                second_datas(index){
                    app.third_show = true
                    app.third_index = index
                },
                hide_datas(){
                    app.third_show = false
                    app.second_show = false
                },
               
                // 返回顶部
                scrollBehavior () {
                    if(document.body.scrollTop > 0) {
                        window.scrollTo(0, -1);
                        document.body.scrollTop = 0;
                    }
                    window.scrollTo(0, -1);
                    document.body.scrollTop = 0;
                },
                

                // 热搜
                hot_lists(){
                    axios({
                        method:"POST",
                        url:base_url + "/searchCount/list",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.hot_list = res.data.data.list.list
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 猜你喜欢
                fondMdses(){
                    axios({
                        method:"POST",
                        url:base_url + "/web/mdse/fondMdse",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.fondMdse = res.data.data.fondMdse
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 热销商品
                
                hotSaleMdse(){
                    axios({
                        method:"POST",
                        url:base_url + "/web/mdse/hotSaleMdse",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.hotsales = res.data.data.hotSales
                         // 热销
                        setTimeout(() => {
                            var swiper = new Swiper('.hot_sell', {
                                autoplay: true,
                                allowTouchMove: false,
                                slidesPerView: 6,         
                                spaceBetween: 3,
                                slidesPerGroup: 1,
                                loop: true,
                                loopFillGroupWithBlank: true,
                                navigation: {
                                    nextEl: '.swiper-button-next',
                                    prevEl: '.swiper-button-prev',
                                },
                                observer:true,//修改swiper自己或子元素时，自动初始化swiper 
                                observeParents:false,//修改swiper的父元素时，自动初始化swiper 
                                onSlideChangeEnd: function(swiper){ 
                                    swiper.update();  
                                    mySwiper.startAutoplay();
                                    mySwiper.reLoop();  
                                },
                            });
                        }, 50);
                           
                        
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                getImageUrlList(){
                    axios({
                        method:"POST",
                        url:base_url + "/ad/getImageUrlList",
                        data:Qs.stringify({
                            code:0,
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.pic = res.data.data.list.list
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },
                // 获取个人信息
                getUserByToken(){
                    axios({
                        method:"POST",
                        url:base_url + "/user/getUserByToken",
                        data:Qs.stringify({
                        }),
                        headers:{
                            'Content-Type':'application/x-www-form-urlencoded',
                            "TOKEN":localStorage.getItem('wACCESS_TOKEN')
                        }
                    })
                    .then(function (res) {
                        app.info = res.data.data.info
                        app.person_infos = false
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
                },

                        // 侧导航
                geren_hover() {
                    this.geren = true
                },
                geren_leave() {
                    this.geren = false
                },
                geren_page(){
                    window.location.href = 'webpage/person_vip/person_order.html'
                },
                gouwuche_hover() {
                    this.gouwuche = true
                },
                gouwuche_leave() {
                    this.gouwuche = false
                },
                gouwuche_page(){
                    window.location.href='webpage/product/shop_car.html'
                },
                shoucang_hover() {
                    this.shoucang = true
                },
                shoucang_leave() {
                    this.shoucang = false
                },
                shoucang_page(){
                    window.location.href='webpage/person_vip/person_collection.html'
                },
                zuji_hover() {
                    this.zuji = true
                },
                zuji_leave() {
                    this.zuji = false
                },
                zuji_page(){
                    window.location.href='webpage/person_vip/person_footprint.html'
                },
                liaotian_hover(){
                    this.liaotian = true
                },
                liaotian_leave(){
                    this.liaotian = false
                },
                feedback(){
                    window.location.href = 'webpage/integral/feedback.html'
                },
                liaotian_page(){
                    window.location.href='webpage/person_vip/person_message.html'
                },
                login_btn(){
                    window.location.href='webpage/login_register/login.html'
                },
                register(){
                    window.location.href='webpage/login_register/register.html'
                },
                person_order(){
                    window.location.href='webpage/person_vip/person_order.html'
                },
                person_address(){
                    window.location.href='webpage/person_vip/person_address.html'
                },
                person_exchange_page(){
                    window.location.href='webpage/person_vip/person_exchange_page.html'
                },
                person_center(){
                    window.location.href='webpage/person_vip/person_center.html?index='+'0'
                },
                person_intergal(){
                    window.location.href='webpage/person_vip/person_integral_order.html'
                },
                person_collection(){
                    window.location.href='webpage/person_vip/person_collection.html'
                },
                person_ticket(){
                    window.location.href='webpage/person_vip/person_ticket.html'
                },
                person_info(){
                    window.location.href='webpage/person_vip/person_info.html'
                },
                person_foot(){
                    window.location.href='webpage/person_vip/person_footprint.html'
                },
                person_message(){
                    window.location.href='webpage/person_vip/person_message.html'
                },
                product_detail(id,shao_id){
                    window.location.href='webpage/product/product_detail.html?id='+id
                },
                group_buy(){
                    window.location.href='webpage/discount/group_buy.html'
                },
                cyc_buy(){
                    window.location.href='webpage/discount/cyc_buy.html'
                },
                group_detail(id,goodsId){
                    // console.log(id)
                    window.location.href='webpage/product/group_detail.html?groupId='+id+'&goodsId='+goodsId
                },
                cyc_detail(spuId,periodBuyId){
                    window.location.href='webpage/product/cyc_detail.html?spuId=' + spuId +'&periodBuyId=' + periodBuyId
                },
                seckilling(){
                    window.location.href='webpage/discount/seckilling.html'
                },
                cyc_buy(){
                    window.location.href='webpage/discount/cyc_buy.html'
                },
                group_buy(){
                    window.location.href='webpage/discount/group_buy.html'
                },
                integral(){
                    window.location.href='webpage/integral/integral.html'
                },
                
                // 显示购物车
                go_shop_car(){
                    window.location.href='webpage/product/shop_car.html'
                },
                car_box(){
                    this.car_active = !this.car_active
                },
                

                // 显示隐藏秒杀按钮
                show_swiper_btn(){
                    this.seckill_swiper_btn = true
                },
                hidden_swiper_btn(){
                    this.seckill_swiper_btn = false
                },
                // 导航条
                person_vip(){
                    if (localStorage.getItem('wACCESS_TOKEN') == '' ||localStorage.getItem('wACCESS_TOKEN') == undefined ||localStorage.getItem('wACCESS_TOKEN') == null) {
                        app.$message.success('请登录');
                    }else{
                        this.services = false
                        this.person_vips = !this.person_vips
                    }
                },
                service(){
                    this.services = !this.services
                    this.person_vips = false
                },
                document_click(){
                    this.services = false
                    this.person_vips = false
                },
            }
        })
    </script>

</body>

</html>